﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
using System.Data;


public partial class AdminPages_Message : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btn_SendToSingleUser_Click(object sender, EventArgs e)
    {
        MembershipUser user = Membership.GetUser(ddl_recipient.SelectedValue);


        DVDTableAdapters.MessageTableAdapter ta = new DVDTableAdapters.MessageTableAdapter();
        ta.Insert((Guid)user.ProviderUserKey, System.DateTime.Now, txt_Content.Text);
        
    }
    protected void btn_SendToAllUsers_Click(object sender, EventArgs e)
    {
        DVDTableAdapters.Customer1TableAdapter ta = new DVDTableAdapters.Customer1TableAdapter();
        DataTable dt = ta.GetData();

        DVDTableAdapters.MessageTableAdapter ta1 = new DVDTableAdapters.MessageTableAdapter();

        foreach (DataRow row in dt.Rows)
        {
            ta1.Insert((Guid)row["CustomerID"], System.DateTime.Now, txt_Content.Text); 
        }

    }
}